package com.xj.demo.classcommand;

public class SwitchTest {
    public void tableSwitch(int num) {
        int value = 0;
        switch (num) {
            case 1:
                value = 10;
                break;
            case 2:
                value = 20;
                break;
            case 3:
                value = 30;
                break;
            case 4:
                value = 40;
                break;
            default:
                break;
        }
    }

    public void lookupSwitch1(int num) {
        int value = 0;
        switch (num) {
            case 100:
                value = 1000;
                break;

            case 200:
                value = 2000;
                break;
            case 300:
                value = 3000;
                break;
            default:
                break;
        }
    }

    public void lookupSwitch2(String str) {
        switch (str) {
            case "hello":
                System.out.println("hello");
                break;
            case "world":
                System.out.println("world");
                break;
            case "java":
                System.out.println("java");
                break;
            default:
                break;
        }
    }
}
